#ifndef _AUDIO_H
#define _AUDIO_H

#include <d3d9.h>
#include <d3dx9.h>

#include "Global.h"
#include "Trace.h"
 
#include "fmod.hpp"
 

#include "Sample.h"

#include <vector>
using namespace std;

class Audio
{
private:
	FMOD_SYSTEM *system;
	typedef vector<Sample*> Samples;
	typedef vector<Sample*>::iterator Iterator;
	Samples samples;

public:
	Audio();
	~Audio();
	FMOD_SYSTEM* getSystem() {return system;}

	bool Init();
	void Update(); //must be called once per frame
	bool Load(string fileName, string name);
	Sample* Load(string fileName);
	bool Play(string name);
	bool PlayBg(string name);
	bool Play(Sample* sample);
	void Stop(string name);
	void StopAll();
	void StopAllExcept(string name);

	bool IsPlaying(string name);
	bool SampleExists(string name);
	Sample* FindSample(string name);
};

#endif
